package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.DmcPatrolGreatLocationMapper;
import com.csun.cmny.provider.dao.DmcPatrolPointBindMapper;
import com.csun.cmny.provider.model.domain.DmcPatrolGreatLocation;
import com.csun.cmny.provider.model.domain.DmcPatrolPointBind;
import com.csun.cmny.provider.model.dto.patrol.PatrolPageQuery;
import com.csun.cmny.provider.model.dto.patrol.PatrolQueryDto;
import com.csun.cmny.provider.model.dto.propertyManagement.SelectDeviceDataDto;
import com.csun.cmny.provider.model.vo.patrol.DmcPatrolVo;
import com.csun.cmny.provider.model.vo.propertyManagement.PropertyDataVo;
import com.csun.cmny.provider.service.DmcPatrolGreatLocationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2021/7/22 9:41
 * @Description: 巡更棒位置绑定接口实现
 */
@Service
public class DmcPatrolGreatLocationServiceImpl extends BaseService<DmcPatrolGreatLocation>
        implements DmcPatrolGreatLocationService {

    @Resource
    private DmcPatrolGreatLocationMapper dmcPatrolGreatLocationMapper;
    @Resource
    private DmcPatrolPointBindMapper dmcPatrolPointBindMapper;


    /*
     * 巡更棒的分页查询
     * */
    @Override
    public PageInfo queryDeviceListWithPage(PatrolPageQuery patrolPageQuery) {
        PageHelper.startPage(patrolPageQuery.getPageNum(), patrolPageQuery.getPageSize());
        List<DmcPatrolVo> dmcDeviceVoList = dmcPatrolGreatLocationMapper.queryDeviceListWithPage(patrolPageQuery);
        return new PageInfo<>(dmcDeviceVoList);
    }
    /*
     * 绑定巡更棒
     * */
    @Override
    public Integer patrolBind(DmcPatrolGreatLocation dmcPatrolGreatLocation) {

        return dmcPatrolGreatLocationMapper.insert(dmcPatrolGreatLocation);
    }
    /*
     * 查询未绑定巡更点的巡更棒
     * */
    @Override
    public List<PatrolPageQuery> selectUntiedPatrol(PatrolPageQuery patrolPageQuery) {
        return dmcPatrolGreatLocationMapper.selectUntiedPatrol(patrolPageQuery);
    }
    /*
     * 查询已绑定巡更点的巡更棒
     * */
    @Override
    public List<PatrolPageQuery> selectBindPatrol(PatrolPageQuery patrolPageQuery) {
        return dmcPatrolGreatLocationMapper.selectBindPatrol(patrolPageQuery);
    }
    /*
    * 查询巡更棒是否绑定
    * */
    @Override
    public List<DmcPatrolPointBind> selectPatrolPoint(Long id) {
        return dmcPatrolPointBindMapper.selectPatrolPoint(id);
    }
    /*
     * 查询用户是否绑定
     * */
    @Override
    public List<DmcPatrolGreatLocation> selectByUserId(Long userId) {
        return dmcPatrolGreatLocationMapper.selectByUserId(userId);
    }
    /*
    * 运营平台设备可视化查询
    * */
    @Override
    public List<PropertyDataVo> selectDeviceData(SelectDeviceDataDto selectDeviceDataDto) {
        return dmcPatrolGreatLocationMapper.selectDeviceData(selectDeviceDataDto);
    }
}
